package com.zzq.demo.tio.client.handler;

import com.alibaba.fastjson.JSONObject;
import com.zzq.demo.tio.common.HelloPacket;
import com.zzq.demo.tio.common.bs.AbsBsHandler;
import com.zzq.demo.tio.common.packet.HelloMsgRespBody;
import lombok.extern.slf4j.Slf4j;
import org.tio.core.ChannelContext;

/**
 * @author : zhaoziqian
 * @description :
 * @date : 2019/10/24 11:11
 */
@Slf4j
public class SimpleMsgRespHandler extends AbsBsHandler<HelloMsgRespBody> {

    @Override
    public Class<HelloMsgRespBody> bodyClass() {
        return HelloMsgRespBody.class;
    }

    @Override
    public Object handler(HelloPacket packet, HelloMsgRespBody bsBody, ChannelContext channelContext) throws Exception {
        log.info("收到服务器信息！！！！！");
        System.out.println();
        System.out.println(JSONObject.toJSONString(bsBody));
        System.out.println();
        return null;
    }
}
